/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lesson3.slides.xml.sax;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class MySaxHandler extends DefaultHandler {

    @Override
    public void startElement(String uri,
            String localName, String qName, Attributes atts)
            throws SAXException {
        System.out.println("startElement " + uri + " "
                + localName + " " + qName + " " + atts);
        for(int i=0;i<atts.getLength();i++){
            
            System.out.println("\tAttribute: "+atts.getLocalName(i)+" value="+atts.getValue(i));
        }
    }

    @Override
    public void endElement(String uri,
            String localName, String qName)
            throws SAXException {
        System.out.println("endElement " + uri + " "
                + localName + " " + qName);
    }

    @Override
    public void characters(char[] chars, int startingIndex, int numberOfChars) throws SAXException {
        String textNodeValue = new String(chars,startingIndex,numberOfChars);
        System.out.println("The text node value is >>"+textNodeValue+"<<");
    }
    
    
}